﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Properties="clr-namespace:Serietheque.Properties"
        xmlns:local="clr-namespace:Serietheque"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
        xmlns:wpfspark="clr-namespace:WPFSpark;assembly=WPFSpark"
        x:Name="Main"
        x:Class="Serietheque.MainWindow"
        Title="Sériethèque"
        MinHeight="500"
        MinWidth="700"
        Closing="Window_Closing"
        Loaded="Window_Loaded"
        Icon="/Serietheque;component/Serietheque.ico"
        Language="fr-FR"
        AllowDrop="True"
        Drop="window_Drop"
        DataContext="{Binding}">
    <Window.Resources>
        <!-- ********************************************** Fin Playliste *************************************************-->

        <local:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <local:WidthZoom x:Key="WidthZoom" />
        <local:TailleConverter x:Key="taillec" />
        <local:WidthDivise x:Key="widthc" />
        <local:WidthConverter x:Key="widthc2" />
        <local:WidthZoom x:Key="width147" />
        <local:InvertBoolConverter x:Key="invertBoolConverter" />
        <local:UriToBitmapConverter x:Key="UriToBitmapConverter" />
        <local:CollectionToWidth x:Key="CollectionToWidth" />
        <local:HeightImage x:Key="HeightImage" />
        <local:WidthImage x:Key="WidthImage" />
        <local:DominantColorOfImage x:Key="DominantColorOfImage" />
        <local:SeriesDataTemplateSelector x:Key="SeriesDataTemplateSelector"/>
        <local:GetLastEpisode x:Key="GetLastEpisode"/>

        <!-- ************************************************* Playliste *************************************************-->
        <Style x:Key="ListBoxPlayListItemContainer" TargetType="{x:Type ListBoxItem}">
            <Setter Property="AllowDrop" Value="True" />
            <EventSetter Event="UIElement.PreviewMouseMove"  Handler="ListBoxPlayListItem_PreviewMouseMove" />
            <EventSetter Event="UIElement.Drop" Handler="ListBoxPlayListItem_Drop" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border Background="White" x:Name="IconBorder" BorderThickness="1,1,1,2" BorderBrush="White">
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="IconBorder" Property="BorderBrush" Value="Gray" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="IconBorder" Property="BorderBrush" Value="{StaticResource Bleu}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- menu context listbox serie -->
        <ContextMenu x:Key="lbMC">
            <MenuItem Header="Lire tout le contenu" Click="MCSerie_LireAll_Click" />
            <MenuItem Header="Tout Ajouter à la playlist" Click="MCSerie_AddPlayList_Click" />
            <Separator />
            <MenuItem Header="Tout Vue" Click="MCSerie_Vue_Click" />
            <MenuItem Header="Tout Non Vue " Click="MCSerie_AnnuleVue_Click" />
            <Separator />
            <MenuItem Header="Chercher Info" Click="MCSerie_GetInfo_Click" />
            <Separator />
            <MenuItem Header="Page TVDB" Click="MCSerie_tvdb_Click" />
            <MenuItem Header="Addic7ed" Click="MCSerie_addic7ed_Click" />
            <Separator />
            <MenuItem Header="Ouvrir emplacement explorer"  Click="MCSerie_OuvrirExplorer_Click" />
            <MenuItem Header="Tout Supprimer" Click="MCSerie_Supprimer_Click" />
        </ContextMenu>
        <!-- Data template ListBoxImage -->
        <DataTemplate x:Key="basicTemplate">
            <Grid Margin="0" Name="self" >
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Border Margin="5,3,2,3"
                        Grid.Row="0"
                        BorderThickness="5"
                        Padding="0"                                    
                        ScrollViewer.VerticalScrollBarVisibility="Disabled"
                        Height="{Binding Value, ElementName=Zoom, Converter={StaticResource HeightImage}}"
                        Width="{Binding Value, ElementName=Zoom,Converter={StaticResource WidthImage}}"
                        HorizontalAlignment="Center" 
                        VerticalAlignment="Center"
                        BorderBrush="{Binding ElementName=mask,Converter={StaticResource DominantColorOfImage},ConverterParameter=2}">
                    <!--CornerRadius="11"-->
                    <!--<Border.Effect>
                        <DropShadowEffect BlurRadius="10" Direction="300" ShadowDepth="10"/>
                    </Border.Effect>-->
                    <Border.Background>
                        <ImageBrush  x:Name="mask" ImageSource="{Binding ImagePath, Converter={StaticResource UriToBitmapConverter}}" />
                    </Border.Background>
                </Border>
                <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2">
                    <CheckBox IsChecked="{Binding Followed}" />
                    <TextBlock Text="{Binding Name}" Foreground="White" FontWeight="Bold" Padding="1" TextWrapping="Wrap" Height="15" Margin="1,0,0,0"/>
                </StackPanel>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="detailedTemplate">
            <Border Margin="5,3,2,3"
                        Grid.Row="0"
                        BorderThickness="5"
                        Padding="0"                                    
                        ScrollViewer.VerticalScrollBarVisibility="Disabled"
                        Height="{Binding Value, ElementName=Zoom, Converter={StaticResource HeightImage}}"
                        Width="{Binding Value, ElementName=Zoom,Converter={StaticResource WidthImage}}"
                        HorizontalAlignment="Center" 
                        VerticalAlignment="Center"
                        BorderBrush="{Binding ElementName=mask,Converter={StaticResource DominantColorOfImage}, ConverterParameter=1}">
                <!--CornerRadius="11"-->
                <!--<Border.Effect>
                    <DropShadowEffect BlurRadius="10" Direction="300" ShadowDepth="10"/>
                </Border.Effect>-->
                <Grid Background="WhiteSmoke">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Image x:Name="mask" Source="{Binding ImagePath, Converter={StaticResource UriToBitmapConverter}}" Grid.RowSpan="2"/>
                    <StackPanel x:Name="SpInfoRight"  Grid.Column="1" HorizontalAlignment="Right" Margin="5,0,5,0" >
                        <Label Content="Jour : "/>
                        <TextBlock Text="{Binding AirDay}"/>
                        <Label Content="Saison(s) : "/>
                        <TextBlock Text="{Binding Saisons.Count}"/>
                    </StackPanel>
                    <StackPanel x:Name="SpNom" Orientation="Vertical" Grid.Row="2" Grid.ColumnSpan="2" Margin="0" VerticalAlignment="Bottom">
                        <!--<StackPanel x:Name="SpInfoBottom" Grid.ColumnSpan="2" Grid.Row="1" Height="100" VerticalAlignment="Stretch" HorizontalAlignment="Left">-->
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Last : "/>
                            <TextBlock Text="{Binding Converter={StaticResource GetLastEpisode},ConverterParameter=1}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Last Add : "/>
                            <TextBlock Text="{Binding Converter={StaticResource GetLastEpisode},ConverterParameter=2}"/>
                        </StackPanel>
                        <Button x:Name="lastEpisodeLink" Content="Last Dispo" Click="LastEpisodes_Click_Handler"/>
                        <!--<Label Content="Nombre d'épisode non vue"/>-->
                        <!--<TextBlock Text="{Binding Converter={StaticResource GetLastEpisode},ConverterParameter=3}"/>-->
                        <!--</StackPanel>-->
                        <StackPanel Orientation="Horizontal">
                            <CheckBox IsChecked="{Binding Followed}" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
                            <TextBlock Text="{Binding Name}" Foreground="White" FontWeight="Bold"  TextWrapping="Wrap" Height="15" Margin="1,0,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </Border>
        </DataTemplate>
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
            <RowDefinition Height="27" />
        </Grid.RowDefinitions>
        <!-- Progress Bar -->
        <!--<Rectangle Fill="#FF2FC2EF" Margin="508,0,0,15" />-->
        <Grid Margin="481,0,0,15" x:Name="GridProgressBar">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="20*" />
                <ColumnDefinition Width="73*" />
            </Grid.ColumnDefinitions>
            <wpfspark:SprocketControl
                                  HorizontalAlignment="Center"
                                  Name="sprocketControl2"
                                  VerticalAlignment="Top"
                                  TickColor="{DynamicResource BleuCyan}"
                                  Width="55"
                                  Height="36"
                                  TickWidth="4"
                                  TickCount="10"
                                  IsIndeterminate="True"
                                  Interval="100"
                                  Grid.Column="0" Visibility="Hidden" />
            <ProgressBar x:Name="progressBarDrop"  Background="#FF2FC2EF" Style="{StaticResource ProgressBarStyle1}" Foreground="#FF2FC2EF" Grid.Column="1" />
            <TextBlock x:Name="txtDrop" Foreground="Black" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" />
            <WrapPanel Name="putain"></WrapPanel>
        </Grid>
        <!-- Fin Progress Bar -->

        <!-- Menu et barre superieur -->
        <StackPanel x:Name="StackPanelMenu" Orientation="Horizontal" HorizontalAlignment="Left">
            <Menu x:Name="MainMenu" Background="{StaticResource Bleu}">
                <MenuItem  Width="25" Height="50">
                    <MenuItem Header="Paramètre" Click="Menu_Preference_Click" />
                    <MenuItem Header="TODO : Consolidation" Click="Menu_Consolidation_Click" />

                    <MenuItem Header="Obtenir les infos des Séries" Click="Menu_GetSeriesInfo_Click" />
                    <MenuItem Header="Liste des épisodes non possédés déja diffusés" Click="Menu_ShowMissedEpisodes_Click" />
                    <Separator/>
                    <MenuItem Header="TODO : Faire le ménage" Click="Menu_Maiday_Click" />
                    <Separator />
                    <MenuItem Header="TODO : Rechercher Episodes dans le dossier par défaut" Click="Menu_FindEpisodes_Click" />
                    <MenuItem Header="Ajouter nouveau épisodes téléchargés" Click="Menu_FindNewEpisodes_Click" />
                    <MenuItem Header="Followed" Click="Menu_GetFollowed_Click" />
                    <MenuItem Header="TODO : Ajouté série à suivre" Click="Menu_AddNewSerie_Click" />
                    <Separator />
                    <MenuItem Header="Obtenir les sous titres de la selection" Click="Menu_MissedSubsSelected_Click" />
                    <MenuItem Header="Ajouter sous titres téléchargés" Click="Menu_FindSrt_Click" />
                    <Separator />
                    <MenuItem Header="Tvdb: UpdateCache" Click="Menu_UpdateCache_Click" />
                    <MenuItem Header="Tvdb: GetSerie" Click="Menu_GetSerie_Click" />
                    <MenuItem Header="Tvdb: Get Images" Click="Menu_GetImages_Click" />
                </MenuItem>
            </Menu>
            <StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}" Margin="0">
                <ToggleButton x:Name="seriesBtn" Style="{StaticResource LinkStyle}" Content="séries" Click="Vue_seriesBtn_Click" />
                <ToggleButton x:Name="toutBtn" Style="{StaticResource LinkStyle}" Content="tout" Click="Vue_toutBtn_Click" />
                <ToggleButton x:Name="recentBtn" Style="{StaticResource LinkStyle}" Content="récent" Click="Vue_recentBtn_Click" />
                <ToggleButton x:Name="nonVueBtn" Style="{StaticResource LinkStyle}" Content="non Vue" Click="Vue_nonvisioBtn_Click" />
                <ToggleButton Content="detail" x:Name="detailSerieBtn" Style="{StaticResource LinkStyle2}" IsChecked="True" />
            </StackPanel>
        </StackPanel>
        <!--Fin  Menu et barre superieur -->

        <!-- Grid Contenu principal-->
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="21" />
                <RowDefinition Height="auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="{Binding Items.Count, Converter={StaticResource CollectionToWidth}, ElementName=ListBoxPlayList, Mode=OneWay}" />
            </Grid.ColumnDefinitions>

            <!-- dockpanel dg episode-->
            <DockPanel Grid.Column="0" x:Name="DockPanelVueDetaillee" Grid.Row="2" >
               
                <Expander x:Name="stackPanelHistorique" DockPanel.Dock="Bottom"  ExpandDirection="Up">
                    <StackPanel>
                        <ScrollViewer x:Name="historiqueSv" Height="118" Margin="0,1,0,1">
                            <TextBlock x:Name="historiqueTb" TextWrapping="Wrap" />
                        </ScrollViewer>
                        <Button x:Name="StopBtn" Content="Stop" Click="StopBtn_Click" Height="20" Width="60" Grid.Row="1" IsEnabled="False" />
                    </StackPanel>
                </Expander>

                <Grid DockPanel.Dock="Top" x:Name="GridDetailSerie" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=detailSerieBtn}" Height=" 200" Background="Black" TextBlock.Foreground="White">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70*"/>
                        <ColumnDefinition Width="123*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="7*"/>
                        <RowDefinition Height="15*"/>
                    </Grid.RowDefinitions>
                   
                    <Image x:Name="imagePathImage" Source="{Binding ImagePath,Converter={StaticResource UriToBitmapConverter}}" MaxHeight="200" Grid.RowSpan="2" />
                   
                    <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0">
                        <TextBlock x:Name="airDayTextBox" Grid.Column="2" HorizontalAlignment="Left" Height="24" Margin="3,4,0,4" Text="{Binding AirDay, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="120" />
                        <TextBlock x:Name="liveTextBox" Grid.Column="2" HorizontalAlignment="Left" Height="24" Margin="3,4,0,4" Text="{Binding Live, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="120" />
                        <TextBlock x:Name="nameTextBox" Grid.Column="2" HorizontalAlignment="Left" Height="24" Margin="3,4,0,4" Text="{Binding Followed, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="120" />
                    </StackPanel>
                    <TextBlock x:Name="overviewTextBox" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" TextWrapping="WrapWithOverflow" Text="{Binding Overview, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"/>

                    <!--<Label Content="Air Day:" Grid.Column="0" HorizontalAlignment="Left" Margin="3,3,0,3" Grid.Row="0" VerticalAlignment="Center" Grid.ColumnSpan="2" />-->
                    <!--<Label Content="Live:" Grid.Column="0" HorizontalAlignment="Left" Margin="3,3,0,3" Grid.Row="2" VerticalAlignment="Center" Grid.ColumnSpan="2" />-->
                    <!--<Label Content="Name:" Grid.Column="0" HorizontalAlignment="Left" Margin="3,3,0,3" Grid.Row="3" VerticalAlignment="Center" Grid.ColumnSpan="2" />-->
                    <!--<Label Content="Overview:" Grid.Column="0" HorizontalAlignment="Left" Margin="3,3,0,3" Grid.Row="4" VerticalAlignment="Center" Grid.ColumnSpan="2" />-->
                </Grid>

                <ListBox x:Name="ListBoxSaison"
                             SelectionChanged="ListBoxSaison_SelectionChanged"
                             ItemContainerStyle="{StaticResource RedGlowItemContainer}"
                             Margin="3"
                             ContextMenu="{StaticResource lbMC}"
                             IsSynchronizedWithCurrentItem="True"
                             ItemsSource="{Binding}"
                             Width="188"
                             MouseDoubleClick="ListBoxSaison_MouseDoubleClick">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel VirtualizingStackPanel.IsVirtualizing="True">
                                <TextBlock x:Name="t1" Text="{Binding Name}" Foreground="Gray" FontWeight="Bold" FontFamily="{DynamicResource HeaderFontFamily}" />
                            </StackPanel>
                            <DataTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="true">
                                    <Setter TargetName="t1" Property="Foreground" Value="Gray" />
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="t1" Property="Foreground" Value="{StaticResource Bleu}" />
                                </Trigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

              
                <!-- datagrid episode -->
                <DataGrid 
                    DockPanel.Dock="Top"
                    x:Name="DataGridEpisodes"
                      CanUserAddRows="False"
                      SelectionMode="Extended"
                      CanUserResizeRows="False"
                      AutoGenerateColumns="False"
                      EnableColumnVirtualization="True"
                      AlternatingRowBackground="#FFF2F5F9"
                      RowBackground="White"
                      GridLinesVisibility="None"
                      HeadersVisibility="Column"
                      MouseDoubleClick="dgEpisode_MouseDoubleClick"
                      IsSynchronizedWithCurrentItem="True"
                      SelectionChanged="dgEpisode_SelectionChanged"
                      IsReadOnly="True"

>
                    <!--SelectionChanged="dgEpisode_SelectionChanged"

                    ItemsSource="{Binding Episodes, UpdateSourceTrigger=PropertyChanged}"

                    -->
                    <DataGrid.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Lire" Click="MenuContext_Lire_Click" />
                            <MenuItem Header="Ajouter à la playlist" Click="MenuContext_AddPlayList_Click" />
                            <Separator />
                            <MenuItem Header="Vue" Click="MenuContext_Visionner_Click" />
                            <MenuItem Header="Annulé Vue " Click="MenuContext_AnnuleVisionner_Click" />
                            <Separator />
                            <MenuItem Header="Chercher Info" Click="MenuContext_GetInfo_Click" />
                            <MenuItem Header="Modifier" Click="MenuContext_Modifier_Click" />
                            <Separator />
                            <MenuItem Header="Page TVDB" Click="MenuContext_tvdb_Click" />
                            <MenuItem Header="SeriesSubs.com" Click="MenuContext_ssubs_Click" />
                            <MenuItem Header="Addic7ed" Click="MenuContext_addic7ed_Click" />
                            <Separator />
                            <MenuItem Header="Ouvrir emplacement explorer"  Click="MenuContext_OuvrirExplorer_Click" />

                            <MenuItem Header="Supprimer sous-titre" Click="MenuContext_SupprimerSousTitre_Click" />
                            <MenuItem Header="Supprimer fichier (et sous titre)" Click="MenuContext_Supprimer_Click" />
                        </ContextMenu>
                    </DataGrid.ContextMenu>
                    <DataGrid.Columns>
                        <!--<DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Content="Update" x:Name="btnUpdate" Click="btnUpdate_Click" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>-->
                        <!--<DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Content="Delete" x:Name="btnDelete" Click="btnDelete_Click" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>-->
                        <DataGridTextColumn Header="Date d'ajout" Binding="{Binding AddDate, StringFormat=d}" SortDirection="Descending" />
                        <DataGridTextColumn Header="Air Date" Binding="{Binding AirDate, StringFormat=d}" />
                        <DataGridTextColumn Header="Nom" Binding="{Binding Name}" CellStyle="{StaticResource Test}" />
                        <DataGridTextColumn Header="Saison" Binding="{Binding Saisons.Num, StringFormat=Saison \{0:D\}}" />
                        <DataGridTextColumn Header="Numéro" Binding="{Binding Num}" />
                        <DataGridTextColumn Header="Série" Binding="{Binding Saisons.Series.Name}" />
                        <DataGridTextColumn Header="Episode" Binding="{Binding Name}" />
                        <DataGridTextColumn Header="Taille" Binding="{Binding Taille, Converter={StaticResource taillec}}" />
                        <DataGridTextColumn Header="Chemin" Binding="{Binding FilePath}"  Width="{Binding Width, Converter={StaticResource widthc2}, ElementName=grid, Mode=OneWay}" />
                    </DataGrid.Columns>
                </DataGrid>
            </DockPanel>

            <!-- grid top -->
            <Grid  Grid.Row="0" Grid.RowSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal" Visibility="{Binding Visibility, ElementName=ListBoxImage}" VerticalAlignment="Center">
                    <Slider x:Name="Zoom" Width="75"  HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" Maximum="220" Minimum="100" Value="170" Margin="0,0,0,0" VerticalAlignment="Center" />
                    <CheckBox x:Name="CheckBoxShowFollowed" IsChecked="{Binding local:SettingBinding OnlyShowFollowed}" Checked="CheckBoxShowFollowed_Checked" Unchecked="CheckBoxShowFollowed_Unchecked" />
                    <TextBlock Text="Suivie" />
                </StackPanel>
                <TextBlock x:Name="TextBlockSerieName" Style="{StaticResource TextBlockStyleSerieName}"  Grid.Column="1" VerticalAlignment="Top" />
                <TextBlock x:Name="TxtBckEpisodesNumber" Style="{StaticResource TextBlockStyleSerieName}"  Grid.Column="1" VerticalAlignment="Top" Visibility="Collapsed" Text="{Binding ElementName=DataGridEpisodes, Path=Items.Count, StringFormat=\{0\} Episode(s)}" />
            </Grid>

            <!-- detail serie -->
            

            <!-- ListBox ListBoxImage-->
            <ListBox Grid.Row="2"
                     x:Name="ListBoxImage"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     Background="{StaticResource GrayBrush3}"
                     VerticalContentAlignment="Stretch"
                     MouseDoubleClick="ListBoxImage_MouseDoubleClick"   
                     SelectionChanged="ListBoxImage_SelectionChanged"
                     ItemsSource="{Binding}" 
                     ItemTemplateSelector="{StaticResource SeriesDataTemplateSelector}" d:IsHidden="True"
                     >
                <ListBox.Resources>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="ContextMenu" Value="{StaticResource lbMC}" />
                    </Style>
                </ListBox.Resources>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel VirtualizingStackPanel.IsVirtualizing="True" IsItemsHost="True" Orientation="Horizontal" ItemWidth="{Binding Value, ElementName=Zoom}" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
            <!-- Fin ListBoxImage -->

            <!-- Playlist-->
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2">
                <ToggleButton Content="lire" Click="PlayListPlay_Click" Style="{StaticResource LinkStyle2}" />
                <ToggleButton Content="effacer" Click="PlayListClear_Click" Style="{StaticResource LinkStyle2}" />
            </StackPanel>
            <ListBox x:Name="ListBoxPlayList"
                     Grid.Row="2"
                     Grid.Column="2" ItemContainerStyle="{DynamicResource ListBoxPlayListItemContainer}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock x:Name="t1" Text="{Binding Name}" Foreground="Gray" FontWeight="Bold" FontFamily="{DynamicResource HeaderFontFamily}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Saison.Serie.Name}" Foreground="Gray" />
                                <TextBlock Text=" - " Foreground="Gray" />
                                <TextBlock Text="{Binding Saison.Num}" Foreground="Gray" />
                                <TextBlock Text="x" Foreground="Gray" />
                                <TextBlock Text="{Binding Num}" Foreground="Gray" />
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Supprimer" Click="PlayListMenu_Delete_Click" />
                    </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>
            <!-- Fin Playlist-->

            <!--<GridSplitter  ResizeDirection="Columns" Width="3" Background="{StaticResource Bleu}"  Visibility="{Binding Visibility, ElementName=ListBoxClassique}" Grid.Row="1" />-->
        </Grid>

        <StatusBar Grid.Row="2" Height="27" x:Name="ContentRow3" BorderThickness="0,2,0,1" BorderBrush="{StaticResource bleucyancool}">
            <StatusBarItem Width="{Binding ActualWidth, ConverterParameter=3, Converter={StaticResource widthc}, ElementName=LayoutRoot, Mode=Default}">
                <TextBlock FontFamily="Calibri" Text="{Binding TraitementText}" Width="253" />
            </StatusBarItem>
            <StatusBarItem HorizontalContentAlignment="Center" Width="{Binding ActualWidth, ConverterParameter=3, Converter={StaticResource widthc}, ElementName=LayoutRoot, Mode=OneWay}">
                <StackPanel Orientation="Horizontal">
                    <!--<TextBlock Text="{Binding EpisodeCollection.Count}" />
                    <TextBlock Text=" Episodes - " />
                    <TextBlock x:Name="tailletb" />-->
                    <TextBlock x:Name="infoNbrTailleST" />
                </StackPanel>
            </StatusBarItem>
            <StatusBarItem HorizontalContentAlignment="Right"  Width="{Binding ActualWidth, ConverterParameter=3, Converter={StaticResource widthc}, ElementName=LayoutRoot, Mode=OneWay}">
                <TextBlock Text="Dossier des Séries : " ><InlineUIContainer>
                		<TextBlock Text="{Binding Serie, Source={x:Static Properties:Settings.Default}}" />
                	</InlineUIContainer></TextBlock>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>